package com.lagou.app;

import com.lagou.dao.PhoneDao;
import com.lagou.entity.Phone;
import org.junit.Test;

import java.sql.SQLException;
import java.util.List;

/**
 * phonedao的测试类
 */
public class TestPhoneDao {

    //获取对象
    PhoneDao phoneDao = new PhoneDao();

    /**
     * 查询查询价格高于2000元，生产日期是2019年之前的所有手机
     * @throws SQLException
     */
    @Test
    public void testGetPhoneByPriceAndYear() throws SQLException {
        List<Phone> list = phoneDao.getPhoneByPriceAndYear(2000, "2019");
        for (Phone phone : list) {
            System.out.println(phone);
        }
    }
    //查询白色手机
    @Test
    public void testGetPhoneByColor() throws SQLException {
        //擦汗寻并打印结果到控制台
        List<Phone> list = phoneDao.getPhoneByColor("白色");
        for (Phone phone : list) {
            System.out.println(phone);
        }
    }
}
